package org.xncj.Impl;

import org.dto.MemberCountDTO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.xncj.MemberService;
import org.xncj.dao.IMemberDao;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Service
@Transactional
public class memberServiceImpl implements MemberService {
    @Resource
    private IMemberDao memberDao;

    @Override
    public List<Integer> findMemberCountByMouth(ArrayList<String> monthList) {
        ArrayList<Integer> memberCounts = new ArrayList<>();
        for(String month:monthList){
            String startTime = month + "." +1;
            String endTime = month + "." +31;
            MemberCountDTO memberCountDTO = new MemberCountDTO();
            memberCountDTO.setStartTime(startTime);
            memberCountDTO.setStartTime(endTime);
            Integer menberCount = memberDao.findMemberCountByMyMonth(memberCountDTO);
            memberCounts.add(menberCount);
        }
        return memberCounts;
    }
}
